package com.feng.leetcode;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author feng
 * @decrition
 * @date 2022/10/3123:46
 */
public class L1771 {
    public int countMatches(List<List<String>> items, String ruleKey, String ruleValue) {
        int result = 0;
        Map<String, Integer> map = new HashMap<>();
        map.put("type", 0);
        map.put("color", 1);
        map.put("name", 2);
        Integer index = map.get(ruleKey);
        for (List<String> item : items) {
            String str = item.get(index);
            if (str.equals(ruleValue)) {
                result++;
            }
        }
        return result;
    }
}
